<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsf/composite"
	xmlns:p="http://primefaces.org/ui">

<ui:decorate template="/jsp/WEB/pageLayout.xhtml">
	<ui:define name="centro">
		<h:form id="form">

			<p:panel header="Dados Para Busca">

				<p:messages id="messages" showDetail="true" autoUpdate="true"
					closable="true" />

				<h:outputScript name="calendario_pt_BR.js" library="js" />

				<!-- *************************************************************** -->
				<!-- Campos de pesquisa -->
				<!-- *************************************************************** -->
				<h:panelGrid id="gridRel" columns="2"
					style="border:0px;margin-top:1%;">

					<p:outputLabel for="date" value="Data inicial:" />
					<p:calendar id="date" value="#{RelatTotalPorTipoVeiculos.iniDate}"
						locale="pt_BR" pattern="dd/MM/yyyy">
					</p:calendar>

					<h:outputLabel for="datefim" value="Data final:" />
					<p:calendar id="datefim" value="#{RelatTotalPorTipoVeiculos.finDate}"
						locale="pt_BR" pattern="dd/MM/yyyy">
					</p:calendar>
					
					<p:commandButton id="searchButton" value="Buscar"
						image="ui-icon-search" update="@form" ajax="false"
						title="Localizar Pedidos"
						actionListener="#{RelatTotalPorTipoVeiculos.load()}" />
				</h:panelGrid>
			</p:panel>
			<br />
			<p:panel header="Totais Por Tipo de Veìculo">

				<f:facet name="actions">
					<h:commandLink
						styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default"
						title="Imprimir">
						<h:outputText styleClass="ui-icon ui-icon-print" />
						<p:printer target="Rel" />
					</h:commandLink>

					<h:commandLink
						styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default"
						style="width:16px;heigh:16px;">
						<p:graphicImage style=" margin-top:1px;margin-left:2px"
							title="Exportar relatório para excel" url="/imagens/ui-xls.png"></p:graphicImage>
						<p:dataExporter type="xls" target="Rel"
							fileName="Totais Por Tipo de Veìculo" />
					</h:commandLink>
				</f:facet>

				<!-- *************************************************************** -->
				<!-- Grid -->
				<!-- *************************************************************** -->
				<p:dataTable id="Rel" value="#{RelatTotalPorTipoVeiculos.movVihicle}" var="rel"
					rowIndexVar="rowIndex" emptyMessage="Nenhum registro encontrado"
					style="position: auto;margin-top:40px" paginator="true" rows="20"
					rowsPerPageTemplate="10,20,30,40,50">

					<p:column style="width: 97px" sortBy="#{rel.getDataOccurenceEnt()}">
						<f:facet name="header">Data</f:facet>
						<h:outputText value="#{rel.getDataOccurenceEnt()}" style="center">
							<f:convertDateTime locale="pt_BR" pattern="dd/MM/yyyy" />
						</h:outputText>
					</p:column>

					<p:column style="width: 97px" sortBy="#{rel.getVehicleType()}">
						<f:facet name="header">Tipo</f:facet>
						<h:outputText value="#{rel.getVehicleType()}"/>
					</p:column>

					<p:column style="width: 97px" sortBy="#{rel.getAmount()}">
						<f:facet name="header">Quant</f:facet>
						<h:outputText value="#{rel.getAmount()}" style="center">
							<f:convertNumber type="number" groupingUsed="true" minFractionDigits="0" pattern="0"/>
						</h:outputText>
						
					</p:column>

					<p:column style="width: 97px" sortBy="#{rel.getVlRate()}">
						<f:facet name="header">Valor Tarifa</f:facet>
						<h:outputText value="#{rel.getVlRate()}" style="float:right">
							<f:convertNumber type="number" groupingUsed="true" minFractionDigits="2" pattern="#0.00"/>
						</h:outputText>
					</p:column>

					<p:column style="width: 97px" sortBy="#{rel.getVlPaid()}">
						<f:facet name="header">Valor Pago</f:facet>
						<h:outputText value="#{rel.getVlPaid()}" style="float:right">							
							<f:convertNumber type="number" groupingUsed="true" minFractionDigits="2" pattern="#0.00"/>
						</h:outputText>
					</p:column>


				</p:dataTable>
			</p:panel>
		</h:form>
	</ui:define>
</ui:decorate>

</html>
